<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<title>提现</title>
<link type="text/css" href="../css/reset.css" rel="stylesheet" />
<link type="text/css" href="../css/public.css" rel="stylesheet" />
<link type="text/css" href="../css/style.css" rel="stylesheet" />
<link type="text/css" href="../css/wode.css" rel="stylesheet" />
<script>
    var deviceWidth = Math.min(640, window.innerWidth)
    document.documentElement.style.fontSize = deviceWidth / 7.5 + "px"
</script>
 <script src="../js/jquery.min.js?v=2.1.4"></script>
 <script src="../js/core.js"></script>
 <script src="../js/bankCard.js"></script>
<!-- <script src="../js/25.3.0zijingguanli.js"></script>-->
</head>

<body>
<!-- top -->
<div class="header">
    <header class="p_header public-red">
        <a href="javascript:history.go(-1);" class="p_header_left">
            <i class="p_left" title="返回"></i>
        </a>
        <h1 class="p_dizhi">提现</h1>
    </header>
</div>
<!--提现-->
<div class="main_bank">
    <div>
        <p>请选择银行卡</p>
        <ul class="bank_link" id="yignhang">
            <li >
               <input type="button" style="width: 100%;height: 100%;" onclick="tianjia()" value="点击选择银行卡"/>
            </li>
        </ul>
    </div>
    <div>
        <p>请输入提现金额</p>
        <ul class="bank_link">
            <li>
                <span>金额</span>
                <input type="number" id="jiaqian" placeholder="请输入提现金额">
            </li>
        </ul>
    </div>
</div>
<div class="mid-width">
    <input type="button" class="p_button" onclick="tixian()" value="确认提现">
</div>
<input type="hidden" id="yinghangid" value="0"/>
<script>
	
	
	var balanceMoney=0;
zhanghuxinxi();
function  zhanghuxinxi(){
   	$.ajax({
		url: urlcore + "/api/userAccount/selectUserAccountDetails",
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
		 balanceMoney=data.data.balanceMoney;
		 
			}
		},
		error:function() {
			/* Act on the event*/
			alert("error");
		}
	});	
}
	$(function(){
		if(getvl("id")!=""){
	$.ajax({      
		url: urlcore + "/api/userBank/selectOne?id="+getvl("id"),
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
			var da=data.data;
			$("#yinghangid").val(da.id);
			 $("#yignhang").html("");
               	 var bankInfo = bankCardAttribution(da.bankNumber);
               	var kahao=da.bankNumber.slice(15);  //加密
               	var OA_task_1=
        '<li class="mui-table-view-cell" id="yinghangid-'+da.id+'">'+
		'<div class="a_bank mui-slider-handle">'+
	        '<div class="a_bank_box">'+//<!--图文-->
	            '<dl class="clearfix">'+
	                '<dt><img src="../images/banke.jpg"></dt>'+
	                '<dd>'+
	                    '<h3>'+da.bankName+'</h3>';
	                 var ssv=0;
	                 $.each(bankInfo, function(q,w) {
	                    	 ssv++;
	                    	 if(ssv==5){
	                    	 	OA_task_1+='<h3>'+w+'</h3>';
	                    	 }
	                    });
	                OA_task_1+='</dd>'+
	            '</dl>'+
	        '</div>'+
	        '<div class="a_shuzi">'+  //<!--数字-->
	             '*** *** ***'+kahao+
	        '</div>'+
	    '</div>'+
	'</li>'+
	 '<li>'+
               '<input type="button"  style="width: 100%;height: 100%;" onclick="tianjia()" value="点击选择银行卡"/>'+
            '</li>';
	  $("#yignhang").append(OA_task_1);
			}else{
				alert(data.msg);
			}
		},
		error:function() {
			/* Act on the event */
			alert("error");
		}
	});	
		}
	});
	 
	 
	 
function tixian(){
	    var qian=parseFloat($("#jiaqian").val());
	    var idsssss=$("#yinghangid").val();
	    if($("#yinghangid").val()!=0){
	    if(qian>=100){
	    	if(qian<=balanceMoney){
	$.ajax({
		url: urlcore + "/api/pay/withdrawals?money="+qian+"&userBankTypeBindId="+idsssss,
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
				alert("已提交等待后台审核");
				window.location.href="20.0.0sell_wode.html";
			}else{
				alert(data.msg);
			}
		},
		error:function() {
			/* Act on the event */
			alert("error");
		}
	});
	
	}else{
		alert("超出提现范围");
	}
	    }else{
	    	alert("提现金额少于100");
	    }
	   }else{
	   	alert("未选择银行卡");
	   }
}
	
</script>
<script>
	 function tianjia(){
	 	    window.location.href="../buy/12.7.4shezhi_bank.html?id="+getvl("id");
	 }
</script>

</body>
</html>